package cms.manage.template.value.impl;

import cms.bean.template.CustomHTML;
import cms.bean.template.Forum;
import cms.manage.template.impl.CustomForumTemplateManage;
import cms.manage.template.value.TplValueStrategy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

import static cms.common.SystemConstant.DisplayType.DISPLAY_ENTITYBEAN;

@Service("自定义版块")
public class CustomForumStrategy implements TplValueStrategy<CustomHTML> {
    @Resource
    CustomForumTemplateManage customForumTemplateManage;//自定义版块 -- 模板方法实现

    @Override
    public CustomHTML doOperation(Forum forum, Map<String, Object> submitParameter, Map<String, Object> runtimeParameter) {
        if(forum.getForumChildType().equals("用户自定义HTML")){
            if(forum.getDisplayType().equals(DISPLAY_ENTITYBEAN.getValue())){//实体对象
                CustomHTML value = customForumTemplateManage.customHTMLEntityBean(forum, submitParameter, runtimeParameter);
                return value;
            }
        }
        return null;
    }
}
